package database;

import java.util.HashMap;


/**
 * @author aioros
 * 
 * Branch informations
 */
public class Branch {

	/*-------------------- Fields ------------------------*/
	
	/** branch id */
	private String branchid;
	
	/** branch name */
	private String name;
	
	/** branch package */
	private String pck;
	
	/** branch creation date */
	private String creationdate;
	
	/** branch last update */
	private String lastupdate;
	
	/** branch description */
	private String description;
	
	/** 
	 * package status 
	 * -> active
	 * -> deprecated
	 * -> deleted
	 */
	private String status;
	
	/**
	 * releases list
	 */
	private HashMap<String,Release> releases = new HashMap<String,Release>();
	
	
	
	/*-------------------- Constructor ------------------------*/
	
	/**
	 * Build a branch
	 */
	public Branch(){
		
	}
	
	
	
	/*-------------------- Constructor ------------------------*/
	
	public String getBranchid() {
		return branchid;
	}



	public void setBranchid(String branchid) {
		this.branchid = branchid;
	}



	public String getCreationdate() {
		return creationdate;
	}



	public void setCreationdate(String creationdate) {
		this.creationdate = creationdate;
	}



	public String getDescription() {
		return description;
	}



	public void setDescription(String description) {
		this.description = description;
	}



	public String getLastupdate() {
		return lastupdate;
	}



	public void setLastupdate(String lastupdate) {
		this.lastupdate = lastupdate;
	}



	public String getName() {
		return name;
	}



	public void setName(String name) {
		this.name = name;
	}



	public String getPck() {
		return pck;
	}



	public void setPck(String pck) {
		this.pck = pck;
	}



	public HashMap<String,Release> getReleases() {
		return releases;
	}



	public void setReleases(HashMap<String,Release> releases) {
		this.releases = releases;
	}
	

	public String getStatus() {
		return status;
	}



	public void setStatus(String status) {
		this.status = status;
	}

	
	public String toString(){
		
		String sbranch = " \n";
		
		sbranch += "	-> branchid :" + branchid + "\n";
	
		sbranch += "		- name : " + name + "\n";
	
		sbranch += "		- pck : " + pck + "\n";
		
		sbranch += "		- creationdate : " + creationdate + "\n";
	
		sbranch += "		- lastupdate : " + lastupdate + "\n";
	
		sbranch += "		- description : " + description + "\n";
		
		sbranch += "		- status : " + status + " \n";
		
			
		for (Release release : releases.values()){
			
			sbranch += release + "\n";
		}
	
		return sbranch;
	}
	
}
